Optimal. Leaf size=155 \[ \frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}+\frac {2 a b \log (\cos (c+d x))}{\left (a^2+b^2\right )^2 d}-\frac {2 a^3 \left (a^2+2 b^2\right ) \log (a+b \tan (c+d x))}{b^3 \left (a^2+b^2\right )^2 d}+\frac {\left (2 a^2+b^2\right ) \tan (c+d x)}{b^2 \left (a^2+b^2\right ) d}-\frac {a^2 \tan ^2(c+d x)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 155, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3646, 3728,
3707, 3698, 31, 3556} \begin {gather*} -\frac {a^2 \tan ^2(c+d x)}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}+\frac {\left (2 a^2+b^2\right ) \tan (c+d x)}{b^2 d \left (a^2+b^2\right )}+\frac {2 a b \log (\cos (c+d x))}{d \left (a^2+b^2\right )^2}+\frac {x \left (a^2-b^2\right )}{\left (a^2+b^2\right )^2}-\frac {2 a^3 \left (a^2+2 b^2\right ) \log (a+b \tan (c+d x))}{b^3 d \left (a^2+b^2\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 3556
Rule 3646
Rule 3698
Rule 3707
Rule 3728
Rubi steps
\begin {align*} \int \frac {\tan ^4(c+d x)}{(a+b \tan (c+d x))^2} \, dx &=-\frac {a^2 \tan ^2(c+d x)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}+\frac {\int \frac {\tan (c+d x) \left (2 a^2-a b \tan (c+d x)+\left (2 a^2+b^2\right ) \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx}{b \left (a^2+b^2\right )}\\ &=\frac {\left (2 a^2+b^2\right ) \tan (c+d x)}{b^2 \left (a^2+b^2\right ) d}-\frac {a^2 \tan ^2(c+d x)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}+\frac {\int \frac {-a \left (2 a^2+b^2\right )-b^3 \tan (c+d x)-2 a \left (a^2+b^2\right ) \tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b^2 \left (a^2+b^2\right )}\\ &=\frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}+\frac {\left (2 a^2+b^2\right ) \tan (c+d x)}{b^2 \left (a^2+b^2\right ) d}-\frac {a^2 \tan ^2(c+d x)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}-\frac {(2 a b) \int \tan (c+d x) \, dx}{\left (a^2+b^2\right )^2}-\frac {\left (2 a^3 \left (a^2+2 b^2\right )\right ) \int \frac {1+\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b^2 \left (a^2+b^2\right )^2}\\ &=\frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}+\frac {2 a b \log (\cos (c+d x))}{\left (a^2+b^2\right )^2 d}+\frac {\left (2 a^2+b^2\right ) \tan (c+d x)}{b^2 \left (a^2+b^2\right ) d}-\frac {a^2 \tan ^2(c+d x)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}-\frac {\left (2 a^3 \left (a^2+2 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \tan (c+d x)\right )}{b^3 \left (a^2+b^2\right )^2 d}\\ &=\frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}+\frac {2 a b \log (\cos (c+d x))}{\left (a^2+b^2\right )^2 d}-\frac {2 a^3 \left (a^2+2 b^2\right ) \log (a+b \tan (c+d x))}{b^3 \left (a^2+b^2\right )^2 d}+\frac {\left (2 a^2+b^2\right ) \tan (c+d x)}{b^2 \left (a^2+b^2\right ) d}-\frac {a^2 \tan ^2(c+d x)}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 2.78, size = 329, normalized size = 2.12 \begin {gather*} \frac {a \left ((a+i b)^2 \left (-2 i a^3-4 a^2 b+2 i a b^2+b^3\right ) (c+d x)+2 a \left (a^2+b^2\right )^2 \log (\cos (c+d x))-a^3 \left (a^2+2 b^2\right ) \log \left ((a \cos (c+d x)+b \sin (c+d x))^2\right )\right )+b \left (2 a^5+3 a^3 b^2+a b^4-2 i a^5 c-4 i a^3 b^2 c+a^2 b^3 c-b^5 c-2 i a^5 d x-4 i a^3 b^2 d x+a^2 b^3 d x-b^5 d x+2 a \left (a^2+b^2\right )^2 \log (\cos (c+d x))-a^3 \left (a^2+2 b^2\right ) \log \left ((a \cos (c+d x)+b \sin (c+d x))^2\right )\right ) \tan (c+d x)+b^2 \left (a^2+b^2\right )^2 \tan ^2(c+d x)+2 i a^3 \left (a^2+2 b^2\right ) \text {ArcTan}(\tan (c+d x)) (a+b \tan (c+d x))}{b^3 \left (a^2+b^2\right )^2 d (a+b \tan (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.16, size = 125, normalized size = 0.81
method | result | size |
derivativedivides | \(\frac {\frac {\tan \left (d x +c \right )}{b^{2}}+\frac {-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}-\frac {a^{4}}{b^{3} \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )}-\frac {2 a^{3} \left (a^{2}+2 b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{3} \left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(125\) |
default | \(\frac {\frac {\tan \left (d x +c \right )}{b^{2}}+\frac {-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}-\frac {a^{4}}{b^{3} \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )}-\frac {2 a^{3} \left (a^{2}+2 b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{3} \left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(125\) |
norman | \(\frac {\frac {\tan ^{2}\left (d x +c \right )}{b d}+\frac {\left (a^{2}-b^{2}\right ) a x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {b \left (a^{2}-b^{2}\right ) x \tan \left (d x +c \right )}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {\left (2 a^{3}+b^{2} a \right ) a}{d \,b^{3} \left (a^{2}+b^{2}\right )}}{a +b \tan \left (d x +c \right )}-\frac {a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {2 a^{3} \left (a^{2}+2 b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) b^{3} d}\) | \(207\) |
risch | \(-\frac {x}{2 i a b -a^{2}+b^{2}}+\frac {4 i a^{5} x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) b^{3}}+\frac {4 i a^{5} c}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) b^{3} d}+\frac {8 i a^{3} x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) b}+\frac {8 i a^{3} c}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) b d}-\frac {4 i a x}{b^{3}}-\frac {4 i a c}{b^{3} d}+\frac {2 i \left (-2 i a^{3} b \,{\mathrm e}^{2 i \left (d x +c \right )}-2 i a \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+2 a^{4} {\mathrm e}^{2 i \left (d x +c \right )}-b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+2 a^{4}+2 a^{2} b^{2}+b^{4}\right )}{\left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left (i b +a \right ) \left (-i b +a \right )^{2} \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+a \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +a \right ) b^{2} d}-\frac {2 a^{5} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) b^{3} d}-\frac {4 a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) b d}+\frac {2 a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{b^{3} d}\) | \(436\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.63, size = 164, normalized size = 1.06 \begin {gather*} -\frac {\frac {a^{4}}{a^{3} b^{3} + a b^{5} + {\left (a^{2} b^{4} + b^{6}\right )} \tan \left (d x + c\right )} + \frac {a b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {{\left (a^{2} - b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (a^{5} + 2 \, a^{3} b^{2}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{4} b^{3} + 2 \, a^{2} b^{5} + b^{7}} - \frac {\tan \left (d x + c\right )}{b^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.88, size = 288, normalized size = 1.86 \begin {gather*} -\frac {a^{4} b^{2} - {\left (a^{3} b^{3} - a b^{5}\right )} d x - {\left (a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}\right )} \tan \left (d x + c\right )^{2} + {\left (a^{6} + 2 \, a^{4} b^{2} + {\left (a^{5} b + 2 \, a^{3} b^{3}\right )} \tan \left (d x + c\right )\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4} + {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \tan \left (d x + c\right )\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (2 \, a^{5} b + 2 \, a^{3} b^{3} + a b^{5} + {\left (a^{2} b^{4} - b^{6}\right )} d x\right )} \tan \left (d x + c\right )}{{\left (a^{4} b^{4} + 2 \, a^{2} b^{6} + b^{8}\right )} d \tan \left (d x + c\right ) + {\left (a^{5} b^{3} + 2 \, a^{3} b^{5} + a b^{7}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 1.02, size = 2312, normalized size = 14.92 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.17, size = 201, normalized size = 1.30 \begin {gather*} -\frac {\frac {a b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {{\left (a^{2} - b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (a^{5} + 2 \, a^{3} b^{2}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{4} b^{3} + 2 \, a^{2} b^{5} + b^{7}} - \frac {2 \, a^{5} b \tan \left (d x + c\right ) + 4 \, a^{3} b^{3} \tan \left (d x + c\right ) + a^{6} + 3 \, a^{4} b^{2}}{{\left (a^{4} b^{3} + 2 \, a^{2} b^{5} + b^{7}\right )} {\left (b \tan \left (d x + c\right ) + a\right )}} - \frac {\tan \left (d x + c\right )}{b^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.27, size = 158, normalized size = 1.02 \begin {gather*} \frac {\mathrm {tan}\left (c+d\,x\right )}{b^2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}{2\,d\,\left (-a^2\,1{}\mathrm {i}+2\,a\,b+b^2\,1{}\mathrm {i}\right )}-\frac {a^4}{b\,d\,\left (\mathrm {tan}\left (c+d\,x\right )\,b^3+a\,b^2\right )\,\left (a^2+b^2\right )}-\frac {2\,a^3\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (a^2+2\,b^2\right )}{b^3\,d\,{\left (a^2+b^2\right )}^2}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (-a^2+a\,b\,2{}\mathrm {i}+b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________